package com.example.voip;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

public class CallActivity extends Activity{
	
	//数字屏幕内容
	EditText num_screen;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_call);
		num_screen = (EditText)findViewById(R.id.num_screen);
	}

	public void onClick_Event(View view) {
		String tag = (String) view.getTag();
		String currentNum = num_screen.getText().toString();//获取当前的号码
		StringBuffer sb = new StringBuffer(currentNum);
		sb.append(tag);										//添加按下的号码
		num_screen.setText(sb.toString());		 			//重置进去
		num_screen.setSelection(sb.length());				//重置光标位置
	}
	
	//拨号键退格
	public void backSpace(View view){
		String currentNum = num_screen.getText().toString();
		if(currentNum.length()>0){
			currentNum = currentNum.substring(0, currentNum.length()-1);
			num_screen.setText(currentNum);
			num_screen.setSelection(currentNum.length());				//重置光标位置
		}
	}
	
}
